package Underworld_Survival;

import java.io.*;
import java.util.*;

// 包含所有需要保存的游戏状态
public class GameSaveData implements Serializable {
    private static final long serialVersionUID = 1L; // 版本标识

    // 玩家数据
    public String pName;
    public int pCurrentHP;
    public int pBaseMaxHP;
    public int pBonusMaxHP;
    public int pTotalMaxHP;
    public int pCurrentAgi;
    public int pBaseMaxAgi;
    public int pBonusMaxAgi;
    public int pTotalMaxAgi;
    public int pBaseStr;
    public int pBonusStr;
    public int pTotalStr;
    public int pBaseDef;
    public int pBonusDef;
    public int pTotalDef;
    public int pBaseEP;
    public int pBonusEP;
    public int pTotalEP;
    public float pBaseCritRate;
    public float pBonusCritRate;
    public float pTotalCritRate;
    public float pBaseCritMultiplier;
    public float pBonusCritMultiplier;
    public float pTotalCritMultiplier;
    public EffectManagerArchive effectManagerData;
    public List<Buff> pBuff;
    public Ability pAbility;
    public Bag pBag;
    public int pGold;
    public int pDiamond;
    public WeaponSlot pWeaponSlot;
    public ArmorSlot pArmorSlot;
    public ShoeSlot pShoeSlot;

    // Buff数据（类型ID + 剩余回合）
    public List<BuffData> pActiveBuffs = new ArrayList<>();

    // 技能数据（类型ID）
    public Set<String> learnedSkills = new HashSet<>();

    // 背包数据（类型ID -> 数量）
    public Map<String, Integer> inventory = new HashMap<>();

    // 进度数据
    public int currentStage;
    public int stageOfMerchantAppears;

    public GameSaveData() {}


    // 嵌套Buff数据类
    public static class BuffData implements Serializable {
        private static final long serialVersionUID = 1L;
        public final String buffId;
        public final int remainingTurns;

        public BuffData(String buffId, int remainingTurns) {
            this.buffId = buffId;
            this.remainingTurns = remainingTurns;
        }
    }

    // 效果管理器存档数据
    public static class EffectManagerArchive implements Serializable {
        private static final long serialVersionUID = 1L;

        // 效果记录集合 <effectId, 记录数据>
        public Map<String, EffectRecordData> effectRecords = new HashMap<>();

        // 来源映射 <sourceId, effectId集合>
        public Map<String, Set<String>> sourceMapping = new HashMap<>();

        // 单条效果记录数据
        public static class EffectRecordData implements Serializable {
            public String sourceId;
            public Map<AttributeType, EffectValueData> modifications;

            public EffectRecordData(String sourceId,
                                    Map<AttributeType, EffectValueData> mods) {
                this.sourceId = sourceId;
                this.modifications = mods;
            }
        }

        // 效果值数据
        public static class EffectValueData implements Serializable {
            public String typeId;       // 类型标识
            public Map<String, Object> params; // 类型参数

            public EffectValueData(String typeId, Map<String, Object> params) {
                this.typeId = typeId;
                this.params = params;
            }
        }
    }

    public String getPName() {return pName;}
    public void setPName(String pName) {this.pName = pName;}
    public int getPCurrentHP() {return pCurrentHP;}
    public void setPCurrentHP(int pCurrentHP) {this.pCurrentHP = pCurrentHP;}
    public int getPBaseMaxHP() {return pBaseMaxHP;}
    public void setPBaseMaxHP(int pBaseMaxHP) {this.pBaseMaxHP = pBaseMaxHP;}
    public int getPBonusMaxHP() {return pBonusMaxHP;}
    public void setPBonusMaxHP(int pBonusMaxHP) {this.pBonusMaxHP = pBonusMaxHP;}
    public int getPTotalMaxHP() {return pTotalMaxHP;}
    public void setPTotalMaxHP(int pTotalMaxHP) {this.pTotalMaxHP = pTotalMaxHP;}
    public int getPCurrentAgi() {return pCurrentAgi;}
    public void setPCurrentAgi(int pCurrentAgi) {this.pCurrentAgi = pCurrentAgi;}
    public int getPBaseMaxAgi() {return pBaseMaxAgi;}
    public void setPBaseMaxAgi(int pBaseMaxAgi) {this.pBaseMaxAgi = pBaseMaxAgi;}
    public int getPBonusMaxAgi() {return pBonusMaxAgi;}
    public void setPBonusMaxAgi(int pBonusMaxAgi) {this.pBonusMaxAgi = pBonusMaxAgi;}
    public int getPTotalMaxAgi() {return pTotalMaxAgi;}
    public void setPTotalMaxAgi(int pTotalMaxAgi) {this.pTotalMaxAgi = pTotalMaxAgi;}
    public int getPBaseStr() {return pBaseStr;}
    public void setPBaseStr(int pBaseStr) {this.pBaseStr = pBaseStr;}
    public int getPBonusStr() {return pBonusStr;}
    public void setPBonusStr(int pBonusStr) {this.pBonusStr = pBonusStr;}
    public int getPTotalStr() {return pTotalStr;}
    public void setPTotalStr(int pTotalStr) {this.pTotalStr = pTotalStr;}
    public int getPBaseDef() {return pBaseDef;}
    public void setPBaseDef(int pBaseDef) {this.pBaseDef = pBaseDef;}
    public int getPBonusDef() {return pBonusDef;}
    public void setPBonusDef(int pBonusDef) {this.pBonusDef = pBonusDef;}
    public int getPTotalDef() {return pTotalDef;}
    public void setPTotalDef(int pTotalDef) {this.pTotalDef = pTotalDef;}
    public int getPBaseEP() {return pBaseEP;}
    public void setPBaseEP(int pBaseEP) {this.pBaseEP = pBaseEP;}
    public int getPBonusEP() {return pBonusEP;}
    public void setPBonusEP(int pBonusEP) {this.pBonusEP = pBonusEP;}
    public int getPTotalEP() {return pTotalEP;}
    public void setPTotalEP(int pTotalEP) {this.pTotalEP = pTotalEP;}
    public float getPBaseCritRate() {return pBaseCritRate;}
    public void setPBaseCritRate(float pBaseCritRate) {this.pBaseCritRate = pBaseCritRate;}
    public float getPBonusCritRate() {return pBonusCritRate;}
    public void setPBonusCritRate(float pBonusCritRate) {this.pBonusCritRate = pBonusCritRate;}
    public float getPTotalCritRate() {return pTotalCritRate;}
    public void setPTotalCritRate(float pTotalCritRate) {this.pTotalCritRate = pTotalCritRate;}
    public float getPBaseCritMultiplier() {return pBaseCritMultiplier;}
    public void setPBaseCritMultiplier(float pBaseCritMultiplier) {this.pBaseCritMultiplier = pBaseCritMultiplier;}
    public float getPBonusCritMultiplier() {return pBonusCritMultiplier;}
    public void setPBonusCritMultiplier(float pBonusCritMultiplier) {this.pBonusCritMultiplier = pBonusCritMultiplier;}
    public float getPTotalCritMultiplier() {return pTotalCritMultiplier;}
    public void setPTotalCritMultiplier(float pTotalCritMultiplier) {this.pTotalCritMultiplier = pTotalCritMultiplier;}
    public List<Buff> getPBuff() {return pBuff;}
    public void setPBuff(List<Buff> pBuff) {this.pBuff = pBuff;}
    public Ability getPAbility() {return pAbility;}
    public void setPAbility(Ability pAbility) {this.pAbility = pAbility;}
    public Bag getPBag() {return pBag;}
    public void setPBag(Bag pBag) {this.pBag = pBag;}
    public WeaponSlot getPWeaponSlot() {return pWeaponSlot;}
    public void setPWeaponSlot(WeaponSlot pWeaponSlot) {this.pWeaponSlot = pWeaponSlot;}
    public ArmorSlot getPArmorSlot() {return pArmorSlot;}
    public void setPArmorSlot(ArmorSlot pArmorSlot) {this.pArmorSlot = pArmorSlot;}
    public ShoeSlot getPShoeSlot() {return pShoeSlot;}
    public void setPShoeSlot(ShoeSlot pShoeSlot) {this.pShoeSlot = pShoeSlot;}
    public int getCurrentStage() {return currentStage;}
    public void setCurrentStage(int currentStage) {this.currentStage = currentStage;}

}